import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author zsj
 * @Version 1.0
 * @Date 2024/2/28 17:54
 * @Description
 */
public class CDiskViewHelper {

    public static void main(String[] args) {
        String path = "C:\\Users\\Lenovo\\Documents";
        System.out.println("开始扫描");
        File file = new File(path);
        File[] files = file.listFiles();
        assert files != null;
        List<File> collect = Arrays.stream(files).sorted((a, b) -> {
            return (int) (b.length() - a.length());
        }).collect(Collectors.toList());
        for (File file1 : collect) {
            System.out.println(file1.getName() + "===" + file1.length());
        }
    }
}
